package com.base.maintain;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class OrNestedRegexMathcer implements StringMatcher {
	private List<Pattern> regexPatterns;

	public OrNestedRegexMathcer(List<Pattern> regexPatterns) {
		super();
		this.regexPatterns = regexPatterns;
	}

	@Override
	public List<String> match(String str) {

		List<String> list = new ArrayList<String>();
		for (Pattern p : regexPatterns) {
			Matcher matcher = p.matcher(str);
			while (matcher.find()) {
				list.add(matcher.group());
			}
		}
		return list;
	}


}